# # Dockerfile
# FROM node:20-alpine AS builder
# WORKDIR /app
# COPY . .
# RUN npm ci && npm run build

# FROM httpd:alpine

# # 复制静态文件
# COPY --from=builder /app/out /usr/local/apache2/htdocs/

FROM httpd:alpine

# 启用 SSL 模块
RUN sed -i 's/#LoadModule ssl_module/LoadModule ssl_module/' /usr/local/apache2/conf/httpd.conf && \
  sed -i 's/#LoadModule socache_shmcb_module/LoadModule socache_shmcb_module/' /usr/local/apache2/conf/httpd.conf && \
  sed -i 's/#Include conf\/extra\/httpd-ssl.conf/Include conf\/extra\/httpd-ssl.conf/' /usr/local/apache2/conf/httpd.conf

# 创建 SSL 目录
RUN mkdir -p /usr/local/apache2/conf/ssl

# 复制证书文件
COPY ssl/gotohere.top_key.key /usr/local/apache2/conf/ssl/
COPY ssl/gotohere.top.pem /usr/local/apache2/conf/ssl/
COPY ssl/ca_bundle.pem /usr/local/apache2/conf/ssl/

# 复制 SSL 配置
COPY docker/httpd-ssl.conf /usr/local/apache2/conf/extra/httpd-ssl.conf

# 直接从本地复制构建结果
COPY ./out /usr/local/apache2/htdocs/

# 暴露端口
EXPOSE 80
EXPOSE 443